home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ultimate Screensaver
/
Ultimate Screen Savers Collection (CMS Distributing) (1996).ISO
/
saver3
/
guitoons
/
guitoons.frm
< prev
next >
Wrap
Text File
|
1995-03-15
|
14KB
|
492 lines
VERSION 2.00
Begin Form frmScrSave
BackColor = &H00000000&
BorderStyle = 0 'None
Caption = "GUIToons"
ClientHeight = 1200
ClientLeft = 1650
ClientTop = 1755
ClientWidth = 5340
Height = 1725
Icon = GUITOONS.FRX:0000
Left = 1590
LinkTopic = "Form1"
ScaleHeight = 1200
ScaleWidth = 5340
Top = 1290
Width = 5460
Begin PictureBox picLoader
Height = 855
Left = 3600
ScaleHeight = 825
ScaleWidth = 825
TabIndex = 3
Top = 180
Width = 855
End
Begin PictureBox picScreenCap
Height = 855
Left = 2490
ScaleHeight = 825
ScaleWidth = 825
TabIndex = 2
Top = 180
Width = 855
End
Begin PictureBox picWorkSpace
Height = 855
Left = 1350
ScaleHeight = 825
ScaleWidth = 825
TabIndex = 1
Top = 180
Width = 855
End
Begin PictureBox picPicture
Height = 855
Index = 0
Left = 240
ScaleHeight = 825
ScaleWidth = 825
TabIndex = 0
Top = 180
Width = 855
End
Begin Timer Timer1
Enabled = 0 'False
Interval = 55
Left = 4680
Top = 180
End
End
DefInt A-Z
Option Explicit
Dim JustAMoment%
' Upon receiving a bad password or cancel, Unload sets
' JustAMoment to TRUE. The timer sets it to FALSE on its
' next event. In between, the screen saver ignores events
' like the mouse-up from the cancel button
Sub Form_Click ()
If Not JustAMoment Then Unload Me
End Sub
Sub Form_KeyPress (KeyAscii As Integer)
If Not JustAMoment Then Unload Me
End Sub
Sub Form_Load ()
Randomize Timer
JustAMoment = False
'-- Setup screen?
If InStr(Command$, "/c") Then
frmSetup.Show 1
Me.Visible = False
Exit Sub
End If
Dim Success%
'-- Read setup data from the CONTROL.INI file
'-- NumBitmaps
NumBitmaps = ReadInt("NumBitmaps", 0)
If NumBitmaps = 0 Then
MsgBox "No bitmaps have been selected. Press Ok to set up", 16, "GUIToons"
frmSetup.Show 1
End
End If
'-- Hide the cursor
HideCursor
'-- MoveSpeed
MoveSpeed = ReadInt("MoveSpeed", 10)
If MoveSpeed < 1 Then MoveSpeed = 10
Dim Interval&, i%
'-- Animation Interval
Interval = ReadInt("Interval", 1)
If Interval < 1 Then Interval = 1
Timer1.Interval = Interval& * 56
'-- Background
ClearScreen% = ReadInt("ClearScreen", False)
'-- Load pictures controls and redim's an array to hold
' Device Context handles.
For i = 1 To NumBitmaps - 1
Load picPicture(i)
Next
ReDim DC(0 To NumBitmaps - 1) As DCType
'-- Initialize the Picture Loader Control
picLoader.AutoRedraw = True
picLoader.Visible = False
picLoader.Left = Screen.Width + 1
picLoader.BorderStyle = 0
'-- Grab the screen's DC
ScreenDC = CreateDC("DISPLAY", "", "", "")
Dim FileName$, KeyName$
'-- Load the first bitmap to determine the size of the picture
' controls (including the MoveSpeed).
FileName$ = ReadString$("Bitmap1")
If Len(FileName$) Then
On Error Resume Next
picLoader.Picture = LoadPicture(FileName$)
picLoader.AutoSize = True
If Err Then
Beep
Success = ShowCursor(True)
MsgBox "Error Loading Bitmap File: " & UCase$(FileName$), 0, "GUIToons"
End
End If
End If
Dim realbWidth!, realbHeight!, twipWidth&, twipHeight&
'-- Determine Width and Height variables
picLoader.ScaleMode = 3
realbWidth = picLoader.ScaleWidth
realbHeight = picLoader.ScaleHeight
bWidth = realbWidth + (MoveSpeed * 2)
bHeight = realbHeight + (MoveSpeed * 2)
twipWidth = bWidth * Screen.TwipsPerPixelX
twipHeight = bHeight * Screen.TwipsPerPixelY
'-- Set up the WorkSpace picture
picWorkSpace.Height = twipHeight
picWorkSpace.Width = twipWidth
picWorkSpace.AutoRedraw = True
picWorkSpace.Visible = False
picWorkSpace.BorderStyle = 0
picWorkSpace.Left = Screen.Width + 1
WorkDC = picWorkSpace.hDC
'-- Set up the ScreenCap picture
picScreenCap.Visible = False
picScreenCap.Left = Screen.Width + 1
If ClearScreen% Then
' don't bother setting up to save the screen
Else
picScreenCap.Height = Screen.Height
picScreenCap.Width = Screen.Width
picScreenCap.AutoRedraw = True
picScreenCap.BorderStyle = 0
ScreenCapDC = picScreenCap.hDC
End If
Dim LoaderDC%, BColor&, OldColor&, TempBMP%, TempDC%, OldBMP%, Dummy%
'-- Load Bitmaps
For i = 0 To NumBitmaps - 1
'-- Hide the animation picture controls.
'-- Set Hidden picture controls' AutoRedraw True.
' They will not hold their pictures' data in memory
' if you do not set AutoRedraw True.
picPicture(i).AutoRedraw = True
picPicture(i).Visible = False
picPicture(i).Left = Screen.Width + 1
picPicture(i).AutoSize = False
picPicture(i).Width = twipWidth
picPicture(i).Height = twipHeight
picPicture(i).BorderStyle = 0
'-- Load the next file.
KeyName$ = "Bitmap" & LTrim$(Str$(i + 1))
FileName$ = ReadString$(KeyName$)
If Len(FileName$) = 0 Then
Beep
Success = ShowCursor(True)
MsgBox "No Bitmaps Specified. You must set up the screen saver with the Control Panel's 'Desktop' applet", 16, "GUIToons"
End
End If
On Error Resume Next
picLoader.Picture = LoadPicture(FileName$)
DoEvents
If Err Then
Beep
Success = ShowCursor(True)
MsgBox "Screen Saver Error - Cannot Find Bitmap File: " & UCase$(FileName$), 16, "GUIToons"
End
End If
'-- DC(x) is an array of DC values (integer array)
DC(i).IntPicDC = picPicture(i).hDC
LoaderDC = picLoader.hDC
'-- The Background color of the DC must be set to the same as
' the upper-left hand pixel color in order to create the mask.
BColor& = GetPixel&(LoaderDC, 0, 0)
OldColor& = SetBkColor&(DC(i).IntPicDC, BColor&)
picPicture(i).BackColor = BColor&
picPicture(i).Refresh
'-- Copy the image from the picLoader control to the picPicture
' control for this frame
DC(i).IntPicDC = picPicture(i).hDC
Success = BitBlt(DC(i).IntPicDC, MoveSpeed, MoveSpeed, realbWidth, realbHeight, LoaderDC, 0, 0, SRCCOPY)
'-- Create mask from the picture:
'-- Create the mask DC, and a bitmap to go in it.
DC(i).IntMaskDC = CreateCompatibleDC(ScreenDC)
DC(i).intMaskBmp = CreateCompatibleBitmap(ScreenDC, bWidth, bHeight)
'-- Move the bitmap into the Mask DC
DC(i).intOldMaskBmp = SelectObject(DC(i).IntMaskDC, DC(i).intMaskBmp)
'-- Create a monochrome bitmap that will be the mask bitmap.
TempBMP = CreateBitmap(bWidth, bHeight, 1, 1, 0&)
'-- Create a temporary DC, and put the mask bitmap into it
TempDC = CreateCompatibleDC(ScreenDC)
OldBMP = SelectObject(TempDC, TempBMP)
'-- Copy the picture into the temporary compatible DC
Success = BitBlt(TempDC, 0, 0, bWidth, bHeight, DC(i).IntPicDC, 0, 0, SRCCOPY)
'-- Copy the compatible DC into the mask (mono) DC
Success = BitBlt(DC(i).IntMaskDC, 0, 0, bWidth, bHeight, TempDC, 0, 0, SRCCOPY)
'-- Clean up
TempBMP = SelectObject(TempDC, OldBMP)
Dummy = DeleteObject(TempBMP)
Dummy = DeleteDC(TempDC)
Next
'-- Set up the form.
Me.ScaleMode = 3
Me.Width = Screen.Width
Me.Height = Screen.Height
Me.Top = 0
Me.Left = 0
Me.AutoRedraw = True
pixWidth = M